Same here. On Big Sur 11.5 Beta and iOS 14.5.5 / 14.4.
Post
Replies
Boosts
Views
Activity
By default, macOS apps built on Xcode are sandboxed. This means they can only access the data within the app directory.
You can either disable sandbox capability in the Signing & Capabilities tab or bundle the executable in your app.
You can register the task inside the init function of the App struct.
@main
struct MyApp: App {
init(){
// Your code
}
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
Or, to use AppDelegate in a SwiftUI lifecycle app, first create a custom class of App Delegate.
class AppDelegate: NSObject, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
}
Then use UIApplicationDelegateAdaptor property wrapper to tell SwiftUI to use your AppDelegate class.
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
You can wrap it inside a SwiftUI ScrollView instead.
ScrollView {
InputView(text: $input)
.padding()
}
You'll also need to disable scrolling of the TextView. To do that, add this inside makeUIView().
textView.isScrollEnabled = false
There's a new API to do this in iOS 15. Note that this is not compatible with previous versions of iOS. You'll also need Xcode 13 beta to build this.
See more at https://www.hackingwithswift.com/quick-start/swiftui/how-to-add-a-toolbar-to-the-keyboard
struct ContentView: View {
@State private var name = "Taylor"
var body: some View {
TextField("Enter your name", text: $name)
.textFieldStyle(.roundedBorder)
.toolbar {
ToolbarItemGroup(placement: .keyboard) {
Button("Click me!") {
print("Clicked")
}
}
}
}
}
Alternatively, you can wrap a UITextView inside your SwiftUI view using UIViewRepresentable. You can then gain access to inputAccessoryView.
Can you also provide your implementation of ImagePicker?
You should implement the updateUIViewController method. When the state of your view is changed, this method is called and you are responsible to update the configuration of your view controller to match the new state information.
See more at https://developer.apple.com/documentation/swiftui/uiviewcontrollerrepresentable/updateuiviewcontroller(_:context:)
func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<ImagePicker>) {
uiViewController.sourceType = sourceType
}
I have the same problem using a swift package with binary target.
Apple please fix this!
Same on my M1 Mac mini (16/256).
I have the same question. I submitted a DTS ticket and will post the result here.
DTS was unable to provide a workaround. Instead, I was suggested to file a bug report at Feedback Assistant. Here is the Feedback ID: FB13243494.